package ft.app.gtig.entity;

import com.haulmont.chile.core.annotations.Composition;
import com.haulmont.cuba.core.entity.FileDescriptor;
import com.haulmont.cuba.core.entity.StandardEntity;

import javax.persistence.*;
import java.util.Date;
import java.util.List;
import java.util.Set;

@Table(name = "GTIG_TIMELINE_EVENT")
@Entity(name = "gtig$TimelineEvent")
public class TimelineEvent extends StandardEntity {
  private static final long serialVersionUID = -4644016431790767508L;

  @Column(name = "STATE", nullable = false)
  protected Integer state;

  @Column(name = "KIND", nullable = false)
  protected Integer kind;

  @Column(name = "TITLE", nullable = false, length = 100)
  protected String title;

  @Temporal(TemporalType.DATE)
  @Column(name = "TIME_BEGIN")
  protected Date timeBegin;

  @Temporal(TemporalType.DATE)
  @Column(name = "TIME_FINISH", nullable = false)
  protected Date timeFinish;

  @Column(name = "LOCATION", nullable = false, length = 100)
  protected String location;

  @Column(name = "GEO_LOCATION", length = 100)
  protected String geoLocation;

  @Lob
  @Column(name = "CONTENT")
  protected String content;

  @Column(name = "IMAGES", length = 333)
  protected String images;

  @Composition
  @OneToMany(mappedBy = "timelineEvent")
  protected List<EventHighlight> highlights;

  @Composition
  @OneToMany(mappedBy = "timelineEvent")
  protected List<EventAgenda> agendas;

  @Column(name = "MEETING_FILE")
  protected String meetingFile;

  @JoinTable(name = "GTIG_TIMELINE_EVENT_PERSON_LINK_CONFIRMED",
    joinColumns = @JoinColumn(name = "TIMELINE_EVENT_ID"),
    inverseJoinColumns = @JoinColumn(name = "PERSON_ID"))
  @ManyToMany(cascade = CascadeType.ALL)
  protected List<Person> confirmedSpeakers;

  @OneToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "OVERVIEW_ID")
  protected Article overview;

  @JoinTable(name = "GTIG_TIMELINE_EVENT_PERSON_LINK_OPENING",
    joinColumns = @JoinColumn(name = "TIMELINE_EVENT_ID"),
    inverseJoinColumns = @JoinColumn(name = "PERSON_ID"))
  @ManyToMany(cascade = CascadeType.ALL)
  protected List<Person> openingSpeech;

  @JoinTable(name = "GTIG_TIMELINE_EVENT_PERSON_LINK_KEYNOTE",
    joinColumns = @JoinColumn(name = "TIMELINE_EVENT_ID"),
    inverseJoinColumns = @JoinColumn(name = "PERSON_ID"))
  @ManyToMany(cascade = CascadeType.ALL)
  protected List<Person> keynoteSpeech;

  @OneToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "PRODUCT_ID")
  protected Article product;


  @JoinTable(name = "GTIG_TIMELINE_EVENT_VIDEO_LINK",
    joinColumns = @JoinColumn(name = "TIMELINE_EVENT_ID"),
    inverseJoinColumns = @JoinColumn(name = "VIDEO_ID"))
  @ManyToMany
  protected Set<Video> video;

  @Column(name = "MID")
  protected Integer mid;
  @Lob
  @Column(name = "LINK")
  protected String link;

  @Column(name = "SORT")
  protected Integer sort;

  @Lob
  @Column(name = "TIME_TBD")
  protected String time_tbd;


  @Column(name = "IS_SURE", nullable = false)
  protected Boolean isSure = false;


  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "LIVE_TALK_ID")
  protected LiveTalk liveTalk;

  public void setLiveTalk(LiveTalk liveTalk) {
    this.liveTalk = liveTalk;
  }

  public LiveTalk getLiveTalk() {
    return liveTalk;
  }


  public void setIsSure(Boolean isSure) {
    this.isSure = isSure;
  }

  public Boolean getIsSure() {
    return isSure;
  }

  public void setSort(Integer sort) {
    this.sort = sort;
  }

  public Integer getSort() {
    return sort;
  }

  public void setTime_tbd(String time_tbd) {
    this.time_tbd = time_tbd;
  }

  public String getTime_tbd() {
    return time_tbd;
  }


  public void setLink(String link) {
    this.link = link;
  }

  public String getLink() {
    return link;
  }


  public String getMeetingFile() {
    return meetingFile;
  }

  public void setMeetingFile(String meetingFile) {
    this.meetingFile = meetingFile;
  }


  public Set<Video> getVideo() {
    return video;
  }

  public void setVideo(Set<Video> video) {
    this.video = video;
  }


  public void setMid(Integer mid) {
    this.mid = mid;
  }

  public Integer getMid() {
    return mid;
  }


  public void setOpeningSpeech(List<Person> openingSpeech) {
    this.openingSpeech = openingSpeech;
  }

  public List<Person> getOpeningSpeech() {
    return openingSpeech;
  }

  public void setKeynoteSpeech(List<Person> keynoteSpeech) {
    this.keynoteSpeech = keynoteSpeech;
  }

  public List<Person> getKeynoteSpeech() {
    return keynoteSpeech;
  }


  public List<Person> getConfirmedSpeakers() {
    return confirmedSpeakers;
  }

  public void setConfirmedSpeakers(List<Person> confirmedSpeakers) {
    this.confirmedSpeakers = confirmedSpeakers;
  }


  public Article getOverview() {
    return overview;
  }

  public void setOverview(Article overview) {
    this.overview = overview;
  }


  public Article getProduct() {
    return product;
  }

  public void setProduct(Article product) {
    this.product = product;
  }


  public void setGeoLocation(String geoLocation) {
    this.geoLocation = geoLocation;
  }

  public String getGeoLocation() {
    return geoLocation;
  }


  public void setAgendas(List<EventAgenda> agendas) {
    this.agendas = agendas;
  }

  public List<EventAgenda> getAgendas() {
    return agendas;
  }


  public void setHighlights(List<EventHighlight> highlights) {
    this.highlights = highlights;
  }

  public List<EventHighlight> getHighlights() {
    return highlights;
  }


  public TimeLineEventStateEnum getState() {
    return state == null ? null : TimeLineEventStateEnum.fromId(state);
  }

  public void setState(TimeLineEventStateEnum state) {
    this.state = state == null ? null : state.getId();
  }


  public TimelineEventKindEnum getKind() {
    return kind == null ? null : TimelineEventKindEnum.fromId(kind);
  }

  public void setKind(TimelineEventKindEnum kind) {
    this.kind = kind == null ? null : kind.getId();
  }


  public void setImages(String images) {
    this.images = images;
  }

  public String getImages() {
    return images;
  }

  public void setContent(String content) {
    this.content = content;
  }

  public String getContent() {
    return content;
  }


  public void setTitle(String title) {
    this.title = title;
  }

  public String getTitle() {
    return title;
  }

  public void setTimeBegin(Date timeBegin) {
    this.timeBegin = timeBegin;
  }

  public Date getTimeBegin() {
    return timeBegin;
  }

  public void setTimeFinish(Date timeFinish) {
    this.timeFinish = timeFinish;
  }

  public Date getTimeFinish() {
    return timeFinish;
  }

  public void setLocation(String location) {
    this.location = location;
  }

  public String getLocation() {
    return location;
  }


}